// eslint-disable-next-line no-unused-vars
import Vue from "vue";
import Vuex from 'vuex'


const countOptions= {
  namespaced:true,
    actions:{
        jiaOdd(context, value) {
            if (context.state.sum % 2) {
                context.commit("JIA", value)
            }
        },
        jiaWait(context, value) {
            setTimeout(()=>{
                context.commit("JIA", value)

            },500)
        }
    },
    mutations:{
        JIA(state, value) {
            state.sum += value
        },
        JIAN(state, value) {
            state.sum -= value
        }
    },
    state:{
        sum: 0
    },
    getters:{
      bigSum(state){
          return state.sum*10
      },
    }
}

Vue.use(Vuex)
const store = new Vuex.Store({
    modules:{
       countabout:countOptions
    }
})
export default store